import React, { Component } from 'react';
import classname from 'classname';
import Style from './Button.less';

class Button extends Component {

  handleClick = (e) => {
		if(typeof this.props.onClick === 'function') {
			this.props.onClick(e);
		} else {
			return;
		}
	}

  render() {
		const classNames = classname(
			[Style.base],			
			{
				[Style.large]: this.props.size === 'large',
				[Style.small]: this.props.size === 'small'
			}
		);
    return (
      <div onClick={this.handleClick} className={classNames} style={this.props.style}>
        {this.props.children}
      </div>
    )
  }
}

export default Button